package routers

import (
	"gitee.com/theegg/go-brick/app/controller/www_api"
	"gitee.com/theegg/go-brick/app/controller/www_api/www_news"
	"gitee.com/theegg/go-brick/app/controller/www_api/www_urban"
	"github.com/gin-contrib/gzip"
	"github.com/gin-gonic/gin"
)

func InitApiRouter(router *gin.Engine) {

	// 需要权限的操作
	wApi := router.Group("/api")

	wApi.POST("/auth/login", www_api.Login)
	wApi.POST("/auth/logout", www_api.Logout)

	wApi.Use(gzip.Gzip(gzip.DefaultCompression))

	wApi.Any("/tour/list", www_urban.GetTourList)
	wApi.Any("/tour/detail", www_urban.GetTourDetail)

	// 获取配置
	wApi.Any("/config/home", www_api.ConfigHome)

	wApi.Any("/news/list", www_news.GetNewsList)
	wApi.Any("/news/detail", www_news.GetNewsDetail)
}
